package com.gusha.model;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name="sys_order")
@NamedQuery(name="SysOrder.findAll", query="SELECT s FROM SysOrder s")
@DynamicInsert
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysOrder implements Serializable{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY) 
	private BigInteger id;
	
    /** 商品id *  */
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="shopping_id")
    private SysShopping shoppingId;
	
    /** 送货地址 */
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="address_id")
    private ReceivingAddress addressId;
	
    /** 产品数量 */
	@Column(name="commodity_num")
    private BigInteger commodityNum;
	
    /** 0未删1已删 */
	@Column(name="is_delete")
    private BigInteger isDelete;
    /** 用户id */
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="user_id")
    private User userId;
	
    /** 1:未支付2:已支付 */
	@Column(name="state")
    private BigInteger state;
	
    /** 添加订单的时间 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="add_time")
    private Date addTime;
	
	
	public BigInteger getId() {
		return id;
	}
	public void setId(BigInteger id) {
		this.id = id;
	}
	public SysShopping getShoppingId() {
		return shoppingId;
	}
	public void setShoppingId(SysShopping shoppingId) {
		this.shoppingId = shoppingId;
	}
	public ReceivingAddress getAddressId() {
		return addressId;
	}
	public void setAddressId(ReceivingAddress addressId) {
		this.addressId = addressId;
	}
	public BigInteger getCommodityNum() {
		return commodityNum;
	}
	public void setCommodityNum(BigInteger commodityNum) {
		this.commodityNum = commodityNum;
	}
	public BigInteger getIsDelete() {
		return isDelete;
	}
	public void setIsDelete(BigInteger isDelete) {
		this.isDelete = isDelete;
	}
	public User getUserId() {
		return userId;
	}
	public void setUserId(User userId) {
		this.userId = userId;
	}
	public BigInteger getState() {
		return state;
	}
	public void setState(BigInteger state) {
		this.state = state;
	}
	public Date getAddTime() {
		return addTime;
	}
	public void setAddTime(Date addTime) {
		this.addTime = addTime;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	
}
